<?php

class room_Form_Frmroom extends Zend_Form
{

	public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	$this->setMethod('post');
    }
    public function fromroom($roomfrom = null){
    	$request=Zend_Controller_Front::getInstance()->getRequest();
		$db = new Application_Model_DbTable_DbGlobal();
		$sql = "Select floor_id,floor_name From tbl_floor";
		$rows=$db->getGlobalDb($sql);
		//print_r($rows);exit();
		$options = array("" =>"- - - Select Type of Floor - - -");	
		foreach($rows as $read) $options[$read['floor_id']]= $read['floor_name'];
		$floor = new Zend_Form_Element_Select('floor_id');
		$floor->setMultiOptions($options);
		$floor->setAttribs(array('floor_id'=>'floor_name','class'=>'form-control validate[required]',"onclick"=>"ShowPopupProduct()"));
		
// 		$sql_room = " Select room_id,room_name From tbl_departments";
// 		$row_room = $db->getGlobalDb($sql_room);
// 		$opstion_room = array("" => " - - - Select Type of Department - - - ");
// 		foreach ($row_room as $read_room) $opstion_room[$read_room['room_id']] = $read_room['room_name'];
// 		$room_name = new Zend_Form_Element_Select("room_id");
// 		$room_name->setMultiOptions($opstion_room);
// 		$room_name->setAttribs(array('room_id'=>'room_name','class'=>'form-control validate[required]'));
// 		//print_r();exit();
		
    	$room = new Zend_Form_Element_Text("room_name");    	   	
    		$room->setAttribs(array("class"=>"form-control validate[required]"));
    	$room_size = new Zend_Form_Element_Text("room_size");
    		$room_size->setAttribs(array("class"=>"form-control validate[required]"));
    	$description = new Zend_Form_Element_Textarea("description");
    		$description->setAttribs(array("class"=>"form-textarea "));	
    	$ordering = new Zend_Form_Element_Text("ordering");
    		$ordering->setAttribs(array("class"=>"form-control validate[required]"));
    		$id = new Zend_Form_Element_Hidden("room_id");
    	$this->addElements( array($floor,$room,$room_size,$ordering,$description,$id));    	
    	if($roomfrom !=""){    	
    		$id->setValue($roomfrom['room_id']);
    		$floor->setValue($roomfrom['floor_id']);
    		$room->setValue($roomfrom['room_name']);
    		$room_size->setValue($roomfrom['room_size']);
    		$description->setValue($roomfrom['description']);
    		$ordering->setValue($roomfrom['ordering']);
    	}
    	return $this;
    }
    public function formfloor(){
    	$floor = new Zend_Form_Element_Text("floor_name");
    	$floor->setAttribs(array("class"=>"form-control validate[required]"));
    	$this->addElement($floor);
    	return $this;
    }
}
    	